<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang='en'>
<head>
	<meta charset='utf-8' />
	<title>广溢信息技术有限公司</title>
	<meta content='' name='description' />
	<meta content='' name='author' />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<!-- Bootstrap -->
	<link href="__PUBLIC__/css/bootstrap.min.css" rel="stylesheet" >
    <link href="__PUBLIC__/css/jquery-ui-1.9.2.custom.css" rel="stylesheet" />
	<link href="__PUBLIC__/css/font-awesome.min.css" rel="stylesheet" >

	<!--[if IE 7]>
		<link  href="__PUBLIC__/css/font-awesome-ie7.min.css" rel="stylesheet">
	<![endif]-->

	<!--[if lt IE 9]>
		<link type="text/css" href="__PUBLIC__/css/custom-theme/jquery.ui.1.9.2.ie.css"  rel="stylesheet" />
	<![endif]-->

	<link href="__PUBLIC__/css/bootstrap-responsive.css" rel="stylesheet">
	<link href="__PUBLIC__/css/test.css" rel="stylesheet">
	<script src="__PUBLIC__/js/jquery.js"></script>

	<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
	<!--[if lt IE 9]>
	<script src="__PUBLIC__/js/html5shiv.js"></script>
	<script src="__PUBLIC__/js/respond.min.js"></script>
	<![endif]-->
	<script type="text/javascript">
	var upload_url="<?php echo U('file/upload?module='.MODULE_NAME);?>";
	var del_url="<?php echo U('File/del');?>";
	var session_id="<?php echo session_id();?>";	
	var _hmt = _hmt || [];
	(function() {
	  var hm = document.createElement("script");
	  hm.src = "//hm.baidu.com/hm.js?2a935166b0c9b73fef3c8bae58b95fe4";
	  var s = document.getElementsByTagName("script")[0]; 
	  s.parentNode.insertBefore(hm, s);
	})();
</script>
</head>
<body>
	<div class="shade"></div>
	<div class="row-fluid navbar visible-phone">
	<div class="row-fluid">
		<a class="brand" href="<?php echo U('home/index');?>">广溢网络</a>
		<a data-toggle="collapse" data-target="#top_menu" class="right">
		<i class="brand icon-th-list"></i>
		</a>
	</div>
	<div class="col-lapse" id="top_menu">
		<ul class="nav nav-pills">
			<?php if(is_array($list_top_menu)): $i = 0; $__LIST__ = $list_top_menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$tag): $mod = ($i % 6 );++$i;?><li>
					<a  href="#" url="<?php echo U($tag['url']);?>" node="<?php echo ($tag["id"]); ?>" onclick="click_top_menu(this)"><?php echo ($tag["name"]); ?></a>
				</li><?php endforeach; endif; else: echo "" ;endif; ?>
		</ul>
	</div>
</div>
<div class="row-fluid navbar hidden-phone">
	<a class="brand" href="<?php echo U('home/index');?>">广溢网络</a>
	<ul class="nav nav-pills">
		<?php if(is_array($list_top_menu)): $i = 0; $__LIST__ = $list_top_menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$tag): $mod = ($i % 6 );++$i;?><li>
				<a  href="#" url="<?php echo U($tag['url']);?>" node="<?php echo ($tag["id"]); ?>" onclick="click_top_menu(this)"><?php echo ($tag["name"]); ?></a>
			</li><?php endforeach; endif; else: echo "" ;endif; ?>
	</ul>
	<aside>
		<span>
			<a href="<?php echo U('UserConfig/index');?>">设置</a>
		</span>
		<span>
			<a href="<?php echo U('profile/index');?>"><?php echo (session('user_name')); ?></a>
		</span>
		<span>
			<a href="<?php echo U('login/logout');?>">退出</a>
		</span>
		&nbsp;&nbsp;
	</aside>
</div>

	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span3 left_menu">
				<div class="visible-phone">
	<h4 class="btn no-border" data-toggle="collapse" data-target="#left_menu">		
			<?php echo ($top_menu_name); ?><i class="icon-angle-down"></i>
		</h4>
	<div class="col-lapse" id="left_menu"><?php echo ($html_left_menu); ?></div>
</div>
<div class="hidden-phone">
	<h4><?php echo ($top_menu_name); ?></h4>
	<div><?php echo ($html_left_menu); ?></div>
</div>
			</div>
			<div class="span9 content">

<script type="text/javascript">
	function add() {
		$("#form_data :input :not(:button)").each(function() {
			$(this).val("");
		});
		$("#form_data :text").each(function() {
			$(this).val("");
		});
		$("#form_data select").each(function() {
			$(this).find('option:first').attr('selected', 'selected');
		});
		$(".sub_left_menu tr.active").removeClass("active");
		$("#opmode").val("add");
	}

	function reset_pwd() {
		if ($("#id").val().length < 1) {
			alert("请选择用户");
			return false;
		}
		winopen("<?php echo U('password');?>?id="+ $("#id").val(), 400, 300);
	}

	function select_dept() {
		winopen("<?php echo U('dept/winpop2');?>", 600, 400);
	}

	function btn_search() {
		sendForm("form_search", "__SELF__");
		$("#form_search").submit();
	}

	function key_search() {
		if (event.keyCode == 13) {
			sendForm("form_search", "__SELF__");
			return false;
		}
	}

	function save() {
		$("#pic").val($("#save_name").val().split(";")[0]);
		if(check_form("form_data")){
			sendForm("form_data", "<?php echo U('save');?>","__URL__");
		}		
	}

  function destroy() {
    var id = $(".sub_left_menu  tr.active").attr('id');
    if(id==undefined){
      alert('请先选择员工');
      return false;
    }
    sendAjax("<?php echo U('del');?>", "id=" + id, function(data) {
        if(data['status']=='1'){
          alert(data['info']);
        }else{
          alert('未成功！'); 
        };
       location.reload();
    });
  }

	function showdata(result) {
		for (var s in result.data) {
			set_val(s,result.data[s]);
		}
		$("#dept_name").val($("#dept_list option[value='" + $("#dept_id").val() + "']").text());
		img_url = "<?php echo C('SAVE_PATH');?>" + $("#pic").val();
		$("#emp_pic").attr("src", img_url.split(";")[0]);
		$("#save_name").val("");
		$("#opmode").val("edit");
	}

	$(document).ready(function(){		
		$(".input-date").datepicker();

		$(".sub_left_menu  tr").click(function() {
			$(".sub_left_menu  tr.active").removeClass("active");
			$(this).attr("class","active");
			sendAjax("<?php echo U('read');?>", "id=" + $(this).attr("id"), function(data) {
				showdata(data);
			});
			return false;
		})
	});

</script>
<div class="admin" >
	<form method="post" action="" id="form_search" name="form_search">
		<div class="row-fluid title">
			<span>用户管理</span>
			<div class="input-append right">
				<input type="text"  onkeydown="key_search();" name="keyword">
				<a class="btn" type="button" onclick="btn_search();"> <i class="icon-search"></i>
				</a>
			</div>
		</div>
	</form>
	<div class="row-fluid operate" >
		<div class="right">
			<a onclick="reset_pwd()" class="btn">设置密码</a>
			<a onclick="add()"  class="btn">新增</a>
			<a onclick="save()"  class="btn">保存</a>
			<a onclick="destroy()"  class="btn">删除</a>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span4 sub_left_menu ">
			<table class="table table-bordered">
				<tr>
					<th>员工编号</th>
					<th>姓名</th>
					<th>状态</th>
				</tr>
				<?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><tr id="<?php echo ($data["id"]); ?>">
						<td><?php echo ($data["emp_no"]); ?></td>
						<td><?php echo ($data["emp_name"]); ?></td>
						<td><?php echo (status($data["is_del"])); ?></td>
					</tr><?php endforeach; endif; else: echo "" ;endif; ?>
			</table>
		</div>
		<div class="span8">
			<form id="form_data" name="form_data" method="post" action="">
				<input type="hidden" id="save_name" name="save_name">
				<input type="hidden" name="id" id="id">
				<input type="hidden" name="pid" id="pid" value="">
				<input type="hidden" name="pic" id="pic" >
				<input type="hidden" name="ajax" id="ajax" value="1">
				<input type="hidden" name="opmode" id="opmode" value="">
				<select type="select-one" id="dept_list" name="dept_list" onchange="" ondblclick="" class="dis" ><?php  foreach($dept_list as $key=>$val) { ?><option value="<?php echo $key ?>"><?php echo $val ?></option><?php } ?></select>
				<table class="table table-bordered" >
					<tr>
						<th>
							<nobr>员工编号*</nobr>
						</th>
						<td>
							<input type="text" id="emp_no" name="emp_no" class="input-small"  check="require" msg="请输入员工编号"></td>
						<th rowspan="4">
							照片
							<br>(120*160)</th>
						<td rowspan="3">
							<img width=120 height=160 id="emp_pic" ></td>
					</tr>
					<tr>
						<th>姓名*</th>
						<td>
							<input type="text" id="emp_name" name="emp_name" class="input-small" check="require" msg="请输入姓名"></td>
					</tr>
					<tr>
						<th>部门*</th>
						<td>
							<div class="controls">
								<div class="input-append">
									<input name="dept_name" class="val input-small" id="dept_name" type="text" msg="请选择部门" check="require" source="<?php echo U('dept/json');?>" />
									<input name="dept_id" class="key" id="dept_id" type="hidden" msg="请选择部门" check="require" />
									<button class="btn" onclick="select_dept()" type="button">选择</button>
								</div>
								<div class="search dropdown ">
									<ul class="dropdown-menu"></ul>
								</div>
							</div>
						</td>
					</tr>
					<tr>
						<th>电子邮箱</th>
						<td>
							<input type="text" id="email" name="email" class="input-small"></td>
						<td>
							<script type="text/javascript" src="__PUBLIC__/js/plupload/plupload.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/plupload/plupload.flash.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/plupload/plupload.html5.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/plupload/plupload.setting.js"></script>
<script>
	$(document).ready(function(){
		uploader_init();
	})
</script>
<div id="uploader">
	<a id="pickfiles" href="javascript:;" class="btn">添加附件</a>
	<div class="table">
		<ul id="file_list">
			<li class="thead">
				<span class="del">删除</span>
				<span class="size">大小</span>
				<span class="auto autocut">文件名</span>
			</li>
			<?php if(!empty($file_list)): if(is_array($file_list)): $i = 0; $__LIST__ = $file_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$file): $mod = ($i % 2 );++$i;?><li class="tbody" id="<?php echo ($file["id"]); ?>" add_file="<?php echo ($file["id"]); ?>" size="<?php echo ($file["size"]); ?>" filename="<?php echo ($file["name"]); ?>">
						<div class="loading"></div>
						<div class="data">
							<span class="del text-center">
								<a class="link del">删除</a>
							</span>
							<span class="size" ><?php echo (reunit($file["size"])); ?></span>
							<span class="auto autocut" title="<?php echo ($file["name"]); ?>">
								<a target="_blank" href="<?php echo U('down?attach_id='.f_encode($file['id']));?>"><?php echo ($file["name"]); ?></a>
								<?php if(($file["extension"]) == "mp4"): ?>(<a class="link down" target="_blank" onclick='winopen("<?php echo U("file/player?attach_id=".f_encode($file["id"]));?>",590,460)' >播放</a> )<?php endif; ?>
							</span>
						</div>
					</li><?php endforeach; endif; else: echo "" ;endif; endif; ?>
		</ul>
	</div>
</div>
						</td>
					</tr>
					<tr>
						<th>性别</th>
						<td>
							<select name="sex" id="sex" class="input-small">
								<option  value="male">男</option>
								<option value="female">女</option>
							</select>
						</td>
						<th>生日</th>
						<td>
							<input type="text" id="birthday" name="birthday" readonly="readonly" class="input-date"></td>
					</tr>
					<tr>
						<th>职级</th>
						<td>
							<select type="select-one" id="rank_id" name="rank_id" onchange="" ondblclick="" class="input-small" ><option value="" >选择组</option><?php  foreach($rank_list as $key=>$val) { ?><option value="<?php echo $key ?>"><?php echo $val ?></option><?php } ?></select>
						</td>
						<th>职位</th>
						<td>
							<select type="select-one" id="position_id" name="position_id" onchange="" ondblclick="" class="input-small" ><option value="" >选择组</option><?php  foreach($position_list as $key=>$val) { ?><option value="<?php echo $key ?>"><?php echo $val ?></option><?php } ?></select>
						</td>
					</tr>
					<tr>
						<th><nobr>负责业务</nobr></th>
						<td colspan="3">
							<input type="text" id="duty" name="duty" class="span12"></td>
					</tr>
					<tr>
						<th>办公室电话</th>
						<td>
							<input type="text" id="office_tel" name="office_tel" class="input-small"></td>
						<th>移动电话</th>
						<td>
							<input type="text" id="mobile_tel" name="mobile_tel" class="input-small"></td>
					</tr>
					<tr>
						<th>状态</th>
						<td colspan="3">
							<select class="input-date"  name="is_del" id="is_del">
								<option  value="0">启用</option>
								<option value="1">禁用</option>
							</select>
						</td>
					</tr>
				</table>
			</form>
		</div>
    <div class="page">
      <?php echo ($page); ?>
    </div>
	</div>
</div>
</div>
		</div>
	</div>
	<div class="msg popout"></div>
	<iframe src="<?php echo U('push/client');?>" class="push" id="push"></iframe>
	<script src="__PUBLIC__/js/bootstrap.min.js"></script>
	<script src="__PUBLIC__/js/jquery-ui-1.9.2.custom.min.js"></script>
	<script src="__PUBLIC__/js/common.js"></script>
</body>
</html>